/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.filter;

import java.util.Collection;

/**
 *
 * @author Rakev
 */
public class FilterChain<E> implements Filter<E> {

    private final Collection<Filter<E>> filterChain;

    public FilterChain(Collection<Filter<E>> filterChain) {
        this.filterChain = filterChain;
    }

    @Override
    public Collection<E> filter(Collection<E> source) {
        Collection<E> result = source;
        for (Filter<E> filter : filterChain){
            result = filter.filter(result);
        }
        return result;
    }
}
